<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo Yii::$app->name;?> 后台管理</title>
<?php $this->HeaderView();?>
</head>
<body class="view_index" id="view_index_Type">
<div class="view-index-nav">
        <h3>模块管理</h3>
  <p class="tips">
        <strong style="color:#F00">卸载</strong>待做。
        </p>
</div>
<div class="pt-20 padding-0-20 hiddene">
                    <div class="slideTxtBox mtop-0">
        <div class="hd">
                    <ul>
                
                <li class="on"><a href="javascript:;"><span></span>基础信息</a></li>
                <li><a href="<?php echo $this->createUrl(['models/import']);?>"><span></span>导入模块</a></li>
            </ul>
                </div>
                </div>


</div>
<form class="view-index-form margin-10-20" method="post" action="<?php echo $this->createUrl('batch');?>" enctype="multipart/form-data">
<input type="hidden" class="input-text" id="_csrf" name="_csrf" value="<?php echo Yii::$app->request->csrfToken;?>">
<table class="view-index-list" border="0" cellspacing="0" cellpadding="0" width="100%">
    <thead>
        <tr>
          
         
                        <th>模块名称</th>
                        <th width="100">模块目录</th>
                        <th width="100">版本号</th>
                        <th width="100">安装时间</th>
                        <th width="100">状态</th>
                        <th width="100">更新缓存</th>
            <th class="edit norightborder">操作</th>
        </tr>
    </thead>
    <tbody>
        <?php
		
    foreach($dirs as $d){
		$modelid = isset($modules[$d]) ? $modules[$d]['modelid'] : 0;
		$name = isset($modules[$d]) ? $modules[$d]['name'] : $d;
		$module = isset($modules[$d]) ? $modules[$d]['path'] : $d;
		$disabled = isset($modules[$d]) ? $modules[$d]['disabled'] : false;
		$sFile = Yii::getAlias('@submodule').'/modules/'.$module.'/config.php';
		$config = file_exists($sFile) ? require($sFile) : [];
		$version = isset($modules[$d]) && $modules[$d]['version'] ? $modules[$d]['version'] : (isset($config['version']) ? $config['version'] : '');
		$addtime = isset($modules[$d]) ? date('Y-m-d', $modules[$d]['addtime']) : '---';
		$configs = "\submodule\modules\\{$module}\Configs";
		$name = $configs::$name;
		//if (array_key_exists($d, $rows)) {
    ?>
    <tr>
        <td><a href="<?php echo $disabled !== false ? $this->createUrl([$module]) : 'javascript:;';?>"><?php echo $name;?></a></td>    
        <td><?php echo $module;?></td>  
        <td><?php echo $version;?></td>  
        <td><?php echo $addtime;?></td>
        <td>
        <?php if ($disabled !== false){?>
        <a href="<?php echo $this->createUrl(['module/disabled', 'module'=>$module, 'disabled'=> $disabled == 1 ?0:1]);?>"><?php echo $disabled == 1 ? '启用': '禁用'?> </a>
        <?php }?>
        </td> 
        <td>
        <a href="<?php echo $this->createUrl(['module/cache', 'module'=>$module, 'goback'=>1 ]);?>">更新缓存</a>
        </td>  
        <td class="td-operation">
        
        <?php if ($disabled === false){?>
        <a href="<?php echo $this->createUrl(['module/install', 'module'=>$module, 'name'=>$name ]);?>">安装</a>
        <?php }else{?>
        <a href="<?php echo $this->createUrl(['module/config', 'modelid'=>$modelid]);?>">配置</a>
        <a href="<?php echo $this->createUrl(['module/unstall', 'module'=>$module, 'name'=>$name ]);?>">卸载</a>
        <?php }?>
        </td>
        <?php
		//}
}
?>    </tr>
        </tbody>
    
</table>

</form>
<div class="pages">

</div>
<?php $this->FooterView();?>
</body>
</html>